#include "app.h"
#include <iostream>
using namespace std;
namespace YQ {

float
getFaceSimilarity (shared_ptr<const ExtractResult> face_1,
                   shared_ptr<const ExtractResult> face_2,
                   shared_ptr<FaceExtractor> extractor)
{
	return extractor->getRecognizer()->CalculateSimilarity (face_1->features.get(), face_2->features.get());
}

bool
faceQualityCheck (shared_ptr<const ImageData> &img,
                  shared_ptr<const ExtractResult> extract_result,
                  string &msg)
{
	QualityChecker checker (img, extract_result);
	if (checker.getBrightnessQuality().level < QualityLevel::MEDIUM) {
		msg = "亮度过高/过低";
		return false;
	}
	if (checker.getClarityQuality().level < QualityLevel::HIGH) {
		msg = "清晰度不够";
		return false;
	}
	if (checker.getPoseQuality().level < QualityLevel::MEDIUM) {
		msg = "姿态不达标";
		return false;
	}
	if (checker.getIntergrityQuality().level < QualityLevel::HIGH) {
		msg = "面部不完整";
		return false;
	}
	if (checker.getResolutionQuality().level < QualityLevel::HIGH) {
		msg = "分辨率/面部尺寸不达标";
		return false;
	}
	msg = "质量检测通过";
	return true;
}

}